<div class="order-box">
    <ol class="flow-steps">
        <li class="current_a"><span class="first">1.Select Product</span></li>
        <li class="current_a"><span>2.Comfirm Information</span></li>
        <li class="current"><span>3.Check Out</span></li>
        <li class="last"><span>4.Payment Processing</span></li>
        <div class="clear"></div>
    </ol>

    <br/>
    <h3>Information</h3>
    <table width="100%" cellspacing="0" cellpadding="4" class="custome-check">
        <tr>
            <th width="120">Coupon: </th>
            <td colspan="3"><?php echo $customer['coupon']; ?></td>

        </tr>
        <tr>
            <th>First name: </th>
            <td width="35%"><?php echo $customer['f_name']; ?></td>
            <th width="120">Last name: </th>
            <td><?php echo $customer['l_name']; ?></td>
        </tr>
        <tr>
            <th>Email Address: </th>
            <td><?php echo $customer['email']; ?></td>
            <th>MSN: </th>
            <td><?php echo $customer['msn']; ?></td>
        </tr>
        <tr>
            <th>Country: </th>
            <td><?php echo $customer['country']; ?></td>
            <th>City: </th>
            <td><?php echo $customer['city']; ?></td>
        </tr>
        <tr>
            <th>Address: </th>
            <td><?php echo $customer['address']; ?></td>
            <th>Contact Phone: </th>
            <td><?php echo $customer['tel']; ?></td>
        </tr>
        <tr>
            <th>Comments: </th>
            <td colspan="3"><?php echo $customer['comment']; ?>sdfsd</td>
        </tr>
    </table>

    <table width="100%" class="order-list" cellspacing="0" cellpadding="4">
        <thead>
            <tr>
                <th align="left" style="padding-left: 10px;">Product</th>
                <th width="100">Price</th>
                <th width="100">Quantity</th>

            </tr>
        </thead>
        <tbody>
            <?php
            $total_price = 0;
            $usd_total_price = 0;//美元总额
            if (!empty($cart->orders)):
                foreach ($cart->orders as $order):
                    $product = Orders::model()->getProduct($order, $order['num']); //获取产品名称和价格
                    $currency_price = WebCurrency::model()->changeCurrency($product['price']); //转为相应汇率价
                    $total_price += $currency_price['price']; //计算总价
                    $usd_total_price += $currency_price['price'];

                    $game_name = ProductCategory::model()->getGameNameById($order['game_id']);
                    $server = ProductCategory::model()->findByPk($order['server_id']);
                    ?>
                    <tr>
                        <td>
                            <b><?php echo $product['product_name']; ?></b>

                            <ul>
                                <li><i><?php echo "<b>Game:</b> {$game_name} <b>Server:</b> {$server->title}"; ?></i></li>
                            </ul>
                        </td>
                        <td align="center"><?php echo $currency_price['tag'] . $currency_price['price']; ?></td>
                        <td align="center"><?php echo $order['num']; ?></td>

                    </tr>
                    <?php
                endforeach;
            endif;
            ?>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="4" align="center">
                    <B>
                        <?php
                        if (!empty($cart->orders)) {
                            ?>
                            Total: <span class="total-price"><?php echo $currency_price['tag'] . $total_price; ?></span> 
                            <?php
                            $offset = Orders::model()->getOffset($customer['coupon'], $total_price);
                            if ($offset > 0) {
                                //$offset_currency = WebCurrency::model()->changeCurrency($offset);
                                echo '&nbsp;&nbsp;&nbsp;&nbsp;Offset: <font color="red">' . $currency_price['tag'] . $offset . '</font>';
                            }
                        } else {
                            echo 'Empty';
                        }
                        ?>
                    </B>
                </td>
            </tr>
        </tfoot>
    </table>
    <br/>
    <h3 style="font-size: 16px;margin-left: 0px;">
        Select your payment method <font color="red">*</font>
    </h3>
    <form method="post" action="<?php echo Yii::app()->createAbsoluteUrl('order/order/payment'); ?>" onsubmit="return checkForm()">
        <dl class="pay-type">
            <?php
            if ($usd_total_price < SysVariate::model()->getVal(2)):
                ?>
                <dt>
                <label clas="radio" for="paypal">
                    <input class="payment-type" value="paypal" id="paypal" type="radio" name="payment"/>
                    PayPal <img align="absmiddle" src="<?php echo $this->baseUrl; ?>/images/paypal2.png" alt="paypal" />
                </label>
                </dt>
                <dd onmouseover="this.style.color='#000'" onmouseout="this.style.color='#999'" style="color: rgb(153, 153, 153);">
                    PayPal has optimized their checkout experience by launching an exciting new improvement to their payment flow. <br>
                    For new buyers, signing up for a PayPal account is now optional. This means you can complete your payment first, and then decide whether to save your information for future purchases.
                </dd>
                <dt>
                
                <label class="radio" for="card">
                    <input class="payment-type" value="card" id="card" type="radio" name="payment"/>
                    Credit Card Through Paypal <img align="absmiddle" src="<?php echo $this->baseUrl; ?>/images/scr_impr_acceptedcards.gif" alt="paypal"/></label>
                </dt>
                <dd onmouseover="this.style.color='#000'" onmouseout="this.style.color='#999'">
                    Pay with your Credit Cards or Debit Cards through Paypal. Safe and Fast!
                </dd>
                <?php
            endif;
            ?>
            <dt>
            <label class="radio" for="w">
                <input class="payment-type" value="westernunion" id="w" type="radio" name="payment" />
                Western Union <img align="absmiddle" src="<?php echo $this->baseUrl; ?>/images/logo-payments.jpg" alt="Western Union"/></label>
            </dt>
            <dd onmouseover="this.style.color='#000'" onmouseout="this.style.color='#999'" style="color: rgb(153, 153, 153);">
                Use the method of payment, you will get 5% off discount immediately.For the transfer information please contact with our live help.<br>
                Please contact our livehelp if you choose to use bank transfer. We can help you finish the process.
                Moneybooker is your wallet for the internet. You can shop and send money worldwide.<br>
                Note - Call Required<br>
                We will require a brief phone call to confirm the details of the purchase for quality assurance purposes. For the fastest service, please come to our live Help to speak directly to a customer service agent following the purchase of an account to complete the call. The login information for the account will be sent within a few minutes of completion of the call.<br>
            </dd>
        </dl>
        <div style="text-align: right;">
            <input class="btn btn-warning btn-large" type="submit" value="Payment >>" />
        </div>
    </form>
</div>
<script>
    function checkForm(){
        var check = false;
        $.each($("input.payment-type"), function(i, n){
            if($(n).attr("checked") == "checked"){
                check=true;
                return false;
            }
        });
        if(check == false){
            alert("Please Select your payment method! ");
        }
        return check;
    }                                                                                          
    
</script>